#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

int main()
{
    int i, j, col, row, *p, a;
    p=NULL;
    
    //Dynamic create a two dimensional array with col "row" rows and "col" columns
    printf ("Enter the number of rows and columns for your matrix:  ");
    scanf ("%d %d", &row, &col );
    
    p=malloc (col*row*sizeof (int));
    
    //Input value for each entry of this matrix
    for (i=0; i<col; i++)
        for (j=0; j<row; j++)
            {
                  printf ("Enter the the entry a[%d %d]", i+1, j+1);
                  scanf ("%d", ((p+i)+j));
                  //printf ("%d",* ((p+i)+j));
                  }
    a=check_max_row (p, col, row);
    printf ("The result of max row is %d",a);
                  getch();
}

int check_max_row (int *p, int col, int row)
{
    int i, j, *sum, max;
    sum=malloc (col*sizeof (int));
    
    for (i=0; i<col; i++)
        *(sum+i)=0;
    
    for (i=0; i<col; i++)
        //*(sum+i)=0;
        for (j=0; j<row; j++)
            *(sum+i)+=(*((p+i)+j));
    max=sum[0];
    for (i=0; i<col-1; i++)
        if (*(sum+i)<*(sum+i+1)) max=*(sum+i+1);
    return max;
           
}
